/*
 * This example is from the book "Java Foundation Classes in a Nutshell".
 * Written by David Flanagan. Copyright (c) 1999 by O'Reilly & Associates.  
 * You may distribute this source code for non-commercial purposes only.
 * You may study, modify, and use this example for any purpose, as long as
 * this notice is retained.  Note that this example is provided "as is",
 * WITHOUT WARRANTY of any kind either expressed or implied.
 */
package edu.idei;

import edu.idei.filetree.*;
import java.io.File;
import javax.swing.DropMode;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;

public class FileTreeDemo {

	public static void main(String[] args) {
		File root = new File(System.getProperty("user.home") +
				"\\Mis documentos\\Arquitecturas de software\\OA");
		
		FileOrderStatus filesInfo = FileOrderStatus.read(root);
		JTree tree = new JTree(filesInfo.getTreeNodes());
		tree.setCellRenderer(new FileTreeRenderer());
		tree.setTransferHandler(new FileNameTransferer(tree, filesInfo));
		tree.setDropMode(DropMode.INSERT);
		tree.setDragEnabled(true);

		// The JTree can get big, so allow it to scroll.
		JScrollPane scrollpane = new JScrollPane(tree);

		// Display it all in a window and make the window appear
		JFrame frame = new JFrame("FileTreeDemo");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(scrollpane, "Center");
		frame.setSize(400, 600);
		frame.setVisible(true);
	}
}